<%
Public Function DateBuffer(ByRef strShortDateTime)
dim arrDate
dim strDate
dim strYear
dim strMonth
dim strDay
dim strTime
dim strHour
dim strMinute
dim strSecond
dim dtDate
dim dtTime

If strShortDateTime = "" Then
	DateBuffer = "Please provide a valid short date and time in the format YYYY/MM/DD hh:mm:ss PM"
	Exit Function
Else
	arrDate = Split(strShortDateTime," ")
	If IsDate(arrDate(0)) = False Then
	Response.Write "arrDate(0) = " & arrDate(0) & "<br>"
		DateBuffer = "Please provide a valid short date in the format YYYY/MM/DD"
	ElseIf IsDate(arrDate(1)) = False Then
		DateBuffer = "Please provide a valid short time in the format hh:mm:ss PM"
	Else
		'Buffer Date
		strDate = arrDate(0)
		strYear = Year(strDate)
		strMonth = Month(strDate)
		strDay = Day(strDate)
		If Len(strDay) < 2 Then
			strDay = "0" & strDay
		End If
		If Len(strMonth) < 2 Then
			strMonth = "0" & strMonth
		End If
		dtDate = strYear & strMonth & strDay
			
		'Buffer Time
		strTime = arrDate(1)
		strHour = Hour(strTime)
		strMinute = Minute(strTime)
		strSecond = Second(strTime)
		If arrDate(2) = "PM" and strHour <= 11 Then
			strHour = strHour + 12
		End If
		If Len(strHour) < 2 Then
			strHour = "0" & strHour
		End If
		If Len(strMinute) < 2 Then
			strMinute = "0" & strMinute
		End If
		If Len(strSecond) < 2 Then
			strSecond = "0" & strSecond
		End If
		dtTime = strHour &  strMinute &  strSecond
						
		DateBuffer = dtDate & " " & dtTime & " " & arrDate(2)
	End If
End If 
				
End Function 'DateBuffer()
%>